import request from '@/utils/request'

export function paginate(form, page, page_size) {
  return request({
    url: 'api/docker/server/paginate',
    method: 'post',
    data: {
      page_num: page,
      page_size: page_size,
      docker_name: form.docker_name,
      docker_host: form.docker_host,
      docker_port: form.docker_port
    }
  })
}

export function save(form) {
  return request({
    url: 'api/docker/server/save',
    method: 'post',
    data: {
      docker_name: form.docker_name,
      docker_host: form.docker_host,
      docker_port: form.docker_port,
      cert_path: form.cert_path,
      config_path: form.config_path,
      api_version: form.api_version,
      registry_url: form.registry_url,
      user_name: form.user_name,
      password: form.password,
      email: form.email,
      max_connect: form.max_connect,
      logger_server_port: form.logger_server_port,
      note: form.note
    }
  })
}

export function detail(server_id) {
  return request({
    url: 'api/docker/server/detail',
    method: 'post',
    data: {
      server_id: server_id
    }
  })
}

export function update(form) {
  return request({
    url: 'api/docker/server/update',
    method: 'post',
    data: {
      server_id: form.server_id,
      docker_name: form.docker_name,
      docker_host: form.docker_host,
      docker_port: form.docker_port,
      cert_path: form.cert_path,
      config_path: form.config_path,
      api_version: form.api_version,
      registry_url: form.registry_url,
      user_name: form.user_name,
      password: form.password,
      email: form.email,
      max_connect: form.max_connect,
      logger_server_port: form.logger_server_port,
      note: form.note
    }
  })
}

export function serverDelete(server_id) {
  return request({
    url: 'api/docker/server/delete',
    method: 'post',
    data: {
      server_id: server_id
    }
  })
}